package com.lyj.cloud.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 
 * @author sunshine
 * @hibernate.class table="T_UsersRoles"
 */
@Entity
@Table(name="t_users_roles")
public class UsersRoles extends BaseIdentity {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * 对应的角色
	 * @hibernate.many-to-one
	 */
	@ManyToOne(fetch=FetchType.LAZY)
	private Role role;
	
	/**
	 * 对应的用户
	 * @hibernate.many-to-one
	 */
	@ManyToOne(fetch=FetchType.LAZY)
	private User user;
	
	/**
	 * 角色在这个用户中的优先级
	 * @hibernate.property
	 */
	@Transient
	private int orderNo;
	
	public UsersRoles() {
		super();
	}

	public UsersRoles(Role role, User user, int orderNo) {
		super();
		this.role = role;
		this.user = user;
		this.orderNo = orderNo;
	}

	public int getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(int orderNo) {
		this.orderNo = orderNo;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
}
